package org.forever.learn.config;

import jdk.jfr.Description;
import org.forever.learn.util.DayCountFunction;
import org.forever.learn.util.DayWeatherFunction;
import org.springframework.ai.model.function.FunctionCallback;
import org.springframework.ai.model.function.FunctionCallbackWrapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.function.Function;

@Configuration
public  class FunctionConfig {

//    @Bean(value = "dayWeatherFunction")
//    @Description("查询客户输入日期的天气")
//    public DayWeatherFunction dayWeatherFunction() {
//        return new DayWeatherFunction(); // function code
//    }

    @Bean(value = "dayCountFunction")
    @Description("查询某客户邮箱的收支情况")
    public Function dayCountFunction() {
        return new DayCountFunction();
    }

    @Bean
    public FunctionCallback weatherFunctionInfo() {

        return FunctionCallbackWrapper.builder(new DayWeatherFunction())
                .withName("dayWeatherFunction") // (1) function name
                .withDescription("查询某天的天气情况") // (2) function description
                .build();
    }
}
